package com.emm.yixun.mobile.adapter;

import java.util.ArrayList;

import com.emm.yixun.mobile.R;
import com.emm.yixun.mobile.model.GetNextReminderList.NextReminderList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class NextUpDateAadapter extends BaseAdapter {

	ArrayList<NextReminderList> list;
	Context context;

	public NextUpDateAadapter(ArrayList<NextReminderList> list, Context context) {
		this.list = list;
		this.context = context;
	}

	public void GetDate(ArrayList<NextReminderList> list) {
		this.list = list;
		notifyDataSetChanged();
	}

	@Override
	public int getCount() {
		return null == list ? 0 : list.size();
	}

	@Override
	public Object getItem(int position) {
		return null == list ? null : list.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHoudlerw v = null;
		if (null == convertView) {
			convertView = LayoutInflater.from(context).inflate(R.layout.nextupdateadapter, null);
			v = new ViewHoudlerw();
			v.drop1 = (TextView) convertView.findViewById(R.id.drop1);
			v.times1 = (TextView) convertView.findViewById(R.id.times1);
			v.title1 = (TextView) convertView.findViewById(R.id.title1);
			convertView.setTag(v);
		} else {
			v = (ViewHoudlerw) convertView.getTag();
		}

		if("1".equals(list.get(position).getIsRead())){
			v.drop1.setText("");
		}else{
			v.drop1.setText("●");
		}
		
		v.title1.setText(list.get(position).getNextRemindContent());

		v.times1.setText(list.get(position).getNextReminderDate());

		return convertView;
	}

	public static class ViewHoudlerw {

		TextView drop1;

		TextView title1;

		TextView times1;

	}

}
